<?php
namespace App\Controllers;

class Travel extends BaseController
{
    public function index()
    {
        $places = new \App\Models\Places();
        $records = $places->findAll();

        $parser = \Config\Services::parser();
        return $parser->setData(['records' => $records])
            ->render('placeslist');
    }

    public function showme($id)
    {
        // 连接模型并获取单个记录
        $places = new \App\Models\Places();
        $record = $places->find($id);

        // 解析模板并传递数据
        $parser = \Config\Services::parser();
        return $parser->setData($record)
            ->render('oneplace');
    }
}